<template>
  <div class="container with-nav-padding">
    <div class="info_wrap">
      <infoItem-small-img :list="list"></infoItem-small-img>
      <load-more @loadMore="loadMore"></load-more>
    </div>
  </div>
</template>

<script>
import loadMore from "@/components/load-more";
import infoItemSmallImg from "@/components/infoItem-small-img.vue";
import { getBusinessSchool } from "@/api/vip";
export default {
  data() {
    return {
      list: [],
      page: 1,
      isAll: false,
      loading: false
    };
  },
  methods: {
    getBusinessSchool(page) {
      getBusinessSchool({ page }).then(res => {
        if (res.status === 200) {
          this.list.push(...res.data.data);
          if (res.data.data.length === 0) {
            this.isAll = true;
            this.$dialog.toast({
              mes: "没有更多了",
              timeout: 1000
            });
          }
        }
        this.loading = false;
      });
    },
    loadMore() {
      if (this.loading || this.isAll || this.list.length === 0) return;
      this.loading = true;
      this.getBusinessSchool(++this.page);
    }
  },
  created() {
    this.getBusinessSchool(1);
  },
  components: {
    infoItemSmallImg,
    loadMore
  }
};
</script>

<style lang="less" scoped>
.container {
  position: relative;
  padding-bottom: 5.96rem;

  .clear {
    clear: both;
  }

  .info_wrap {
  }
}
</style>
